from knowledge.models import Commonsense, Chineseidiom, Character, IdiomBroker
from django.contrib import admin

class CommonsenseAdmin(admin.ModelAdmin):
	fields = ['category', 'name', 'explanation', 'full_version', 'is_raised', 'pub_date']
	
#	list_filter = ('is_raised')




class IdiomBrokerInline(admin.TabularInline):
	model = Chineseidiom.characters.through
	extra = 0

class ChineseidiomAdmin(admin.ModelAdmin):
	fields = ['name','explanation','is_raised','pub_date']
	inlines = [
			IdiomBrokerInline,
	]

class CharacterAdmin(admin.ModelAdmin):
	inlines = [
			IdiomBrokerInline,
	]


admin.site.register(Commonsense, CommonsenseAdmin)
admin.site.register(Chineseidiom, ChineseidiomAdmin)
admin.site.register(Character, CharacterAdmin)
admin.site.register(IdiomBroker)